package qf.controller;

import cn.dsna.util.images.ValidateCode;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author 86198
 * @version V1.0
 * @Project Java_qf
 * @Package qf.controller
 * @Description:
 * @Date 2022/5/21 22:17
 */
@WebServlet("/code")
public class Code extends BaseServlet {

    public void createCode(HttpServletRequest request, HttpServletResponse response) {
        ValidateCode code = new ValidateCode(100, 50, 4, 3);
        String code1 = code.getCode();
        request.getSession().setAttribute("codes", code1);
        try {
            code.write(response.getOutputStream());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
